package com.netease.charge.controller;

import com.netease.charge.common.util.DateUtil;
import com.netease.charge.controller.util.VelocityUtil;
import com.netease.charge.service.BillProjectQuery;
import com.netease.charge.service.vo.BillProjectServiceVO;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;
import java.util.Date;

/**
 * @author hzhuqun
 * @create 2016-09-28 下午8:17
 **/

@Controller
@RequestMapping(value = "/v2/biz/test")
public class TestController {

    @Resource
    private BillProjectQuery billProjectQuery;

    @Resource
    private VelocityUtil velocityUtil;

    @RequestMapping(value = "", method = RequestMethod.GET)
    public String getServiceConsume(Model model) {

        Date start =  DateUtil.getCurrentMonthBegin();
        Date end = new Date();
        BillProjectServiceVO billProjectServiceVO = billProjectQuery.queryUserDetailBill(
                    "44104f22e4b24bacbae38f23e6b5aff8", start, end);

        model.addAttribute("num", 2.8999);
        model.addAttribute("bill", billProjectServiceVO);
        return "test";
    }

    @RequestMapping(value = "/v1", method = RequestMethod.GET)
    public String getServiceConsume1(Model model) {
        return velocityUtil.load();
    }


}
